//package com.zmn.plat.dubbo.impl.servcategory;
//
//import java.util.List;
//import java.util.stream.Collectors;
//
//import javax.annotation.Resource;
//
//import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
//import org.apache.dubbo.config.annotation.Service;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cglib.beans.BeanCopier;
//
//import com.zmn.common.constant.GlobalConsts;
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.plat.business.interfaces.servcategory.ShowCategoryAssociationBService;
//import com.zmn.plat.common.dto.servcategory.ServCategorySimpleDRO;
//import com.zmn.plat.common.dto.servcategory.ShowCategoryAssociationDRO;
//import com.zmn.plat.common.exception.PlatException;
//import com.zmn.plat.dubbo.interfaces.servcategory.ShowCategoryAssociationListRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import com.zmn.plat.model.entity.servcategory.ShowCategoryAssociationVO;
//import com.zmn.plat.services.interfaces.servcategory.ShowCategoryAssociationService;
//
//import lombok.extern.slf4j.Slf4j;
//
///**
// * @author tanghongjun
// * @description
// * @since 2019/9/20 11:20
// * @modifier tanghongjun
// **/
//@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
//@Slf4j
//public class ShowCategoryAssociationListRemoteServiceImpl implements ShowCategoryAssociationListRemoteService {
//    @Resource
//    ShowCategoryAssociationBService showCategoryAssociationBService;
//
//    @Autowired
//    ShowCategoryAssociationService showCategoryAssociationService;
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ShowCategoryAssociationDRO>> listByServCategIdAndCategoryIdAndCategId(Integer servCategId, Integer categOneId, Integer categId) {
//        log.info("listByServCategIdAndCategoryIdAndCategId param is :servCategId={},categOneId={},categId={}", servCategId, categOneId, categId);
//        try {
//            List<ShowCategoryAssociationVO> voList = showCategoryAssociationBService.listByCategoryId(servCategId, categOneId, categId);
//            return this.returnDroList(voList);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("listByServCategIdAndCategoryIdAndCategId error.servCategId={},categOneId={},categId={}", servCategId, categOneId, categId, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ShowCategoryAssociationDRO>> listByShowCategoryIdAndShowCategOneIdAndShowCategId(Integer showServCategId, Integer showCategOneId, Integer showCategId) {
//        log.info("listByShowCategoryIdAndShowCategOneIdAndShowCategId param is :showServCategId={},showCategOneId={},showCategId={}", showServCategId, showCategOneId, showCategId);
//        try {
//            List<ShowCategoryAssociationVO> voList = showCategoryAssociationBService.listByShowCategoryId(showServCategId, showCategOneId, showCategId);
//
//            return this.returnDroList(voList);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("listByShowCategoryIdAndShowCategOneIdAndShowCategId error.showServCategId={},showCategOneId={},showCategId={}", showServCategId, showCategOneId, showCategId, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ServCategorySimpleDRO>> listServCategoryByShowCategoryId(Integer showCategId) {
//        log.info("listServCategoryByShowCategoryId 参数为：{}", showCategId);
//
//        try {
//            List<ServCategorySimpleDRO> voList = showCategoryAssociationBService.listServCategByShowCategId(showCategId);
//            return ResponseDTO.success(voList);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        } catch (Exception e) {
//            log.error("listServCategoryByShowCategoryId error.showCategId={}", showCategId, e);
//            return ResponseDTO.fail(GlobalConsts.FAILD_MSG);
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ShowCategoryAssociationDRO>> listAll() {
//        List<ShowCategoryAssociationVO> associations = showCategoryAssociationService.listByShowCategoryId(null, null, null);
//        return returnDroList(associations);
//    }
//
//    private ResponseDTO<List<ShowCategoryAssociationDRO>> returnDroList(List<ShowCategoryAssociationVO> voList) {
//        BeanCopier copier = BeanCopier.create(ShowCategoryAssociationVO.class, ShowCategoryAssociationDRO.class, false);
//        List<ShowCategoryAssociationDRO> dros = voList.stream().map(showCategoryAssociationVO -> {
//            ShowCategoryAssociationDRO showCategoryAssociationDRO = new ShowCategoryAssociationDRO();
//            copier.copy(showCategoryAssociationVO, showCategoryAssociationDRO, null);
//            return showCategoryAssociationDRO;
//        }).collect(Collectors.toList());
//        return ResponseDTO.success(dros);
//    }
//}
